<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<table cellpadding="0" cellspacing="0">
	<tr>
		<td style="padding-left: 270; padding-top: 20">
			共<b>${totalItems}</b>条记录&nbsp;<c:if test="${pageTotalNum != 0}">当前第<b>${currentPage}</b>/<b>${pageTotalNum}</b>页</c:if>
			<c:if test="${currentPage != 1}"><a href="../part?id=<%=(String) session.getAttribute("choice_id")%>&indexPage=1">首页</a></c:if> 
			<c:if test="${currentPage != 1}"><a href="../part?id=<%=(String) session.getAttribute("choice_id")%>&indexPage=2">上一页</a></c:if>
			<c:if test="${currentPage != pageTotalNum && pageTotalNum != 0}"><a href="../part?id=<%=(String) session.getAttribute("choice_id")%>&indexPage=3">下一页</a></c:if>
			<c:if test="${currentPage != pageTotalNum && pageTotalNum != 0}"><a href="../part?id=<%=(String) session.getAttribute("choice_id")%>&indexPage=4">末页</a></c:if>
			<c:if test="${pageTotalNum != 0}"><input type="text" size=3 name="inputContext" id="inputContext" />页
			<a href="#" id="forward" onclick="checkForward('<%=(String) session.getAttribute("choice_id")%>','${pageTotalNum}')">跳转</a></c:if>
		</td>
	</tr>
</table>


<script type="text/javascript">
	function checkForward(id,pageTotalNum) {
		var input = document.getElementById("inputContext").value;
		var regex = /^[1-9][0-9]*$/;
		var str = "javascript:;";
		if (input == "" ) {
			alert("输入的数字不能为空!");
			document.getElementById("forward").href = str;
		} else if (!regex.test(input)) {
			alert("输入的数字不符合要求!");
			document.getElementById("forward").href = str;
		} else if (input > pageTotalNum) {
			alert("输入的数字超过最大页数!");
			document.getElementById("forward").href = str;
		} else {
			document.getElementById("forward").href = "../part?id="+id+"&indexPage=5&forwardPage="+input;
		}
	}
</script>
